use std::fmt::{Debug, Display};

fn printer<T: Display>(t: T) {
    println!("{}", t);
}

struct S<T: Display>(T);

#[derive(Debug, Default)]
struct Rectangle {
    length: f64,
    height: f64,
}
#[allow(dead_code)]
struct Triangle {
    length: f64,
    height: f64,
}


trait HasArea {
    fn area(&self) -> f64;
}

impl HasArea for Rectangle {
    fn area(&self) -> f64 {
        self.length * self.height
    }
}

fn print_debug<T: Debug>(t: &T) {
    println!("{:?}", t);
}

fn area<T: HasArea>(t: &T) -> f64 { t.area() }


fn main() {
    println!("Hello, world!");
    let rectangle = Rectangle { length: 3.0, height: 4.0 };
    let _triangle = Triangle { length: 3.0, height: 4.0 };
    print_debug(&rectangle);
    println!("Area:{}", area(&rectangle));
}
